/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ar.edu.utn.frsf.tpae.a2012.g03.model;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.*;


/**
 * Clase del modelo de datos (persistente). Representa un Cliente. 
 * @author fededalla
 */
@Entity
@Table(name = "cli")
public class Cliente {
	   	@Id
	    @Column(name = "cli_id")
	    private Integer cliId;
	    @Column(name = "cli_nro", nullable = false, length = 16)
	    private String cliNro;
	    @Column(name = "cli_nom", nullable = false, length = 48)
	    private String cliNom;
	    @Column(name = "cli_ape", nullable = false, length = 48)
	    private String cliApe;
	    @Column(name = "cli_dni", nullable = false, length = 10)
	    private String cliDni;
	    @Column(name = "cli_cuil", nullable = false, length = 16)
	    private String cliCuil;
	    @Column(name = "cli_fech_alta", nullable = false)
	    @Temporal(TemporalType.TIMESTAMP)
	    private Date cliFechAlta;
	    @Column(name = "cli_dir_pos", nullable = false, length = 48)
	    private String cliDirPos;
	    @Column(name = "cli_tel", length = 20)
	    private String cliTel;
	    @Column(name = "cli_mail", length = 48)
	    private String cliMail;
	    @OneToMany(cascade = CascadeType.ALL, mappedBy = "ctaCliId")
	    private List<Cuenta> ctaList;

    public Cliente() {
    }

    public Cliente(Integer cliId) {
        this.cliId = cliId;
    }

    public Cliente(Integer cliId, String cliNro, String cliNom, String cliApe, String cliDni, String cliCuil, Date cliFechAlta, String cliDirPos, String cliTel, String cliMail) {
        this.cliId = cliId;
        this.cliNro = cliNro;
        this.cliNom = cliNom;
        this.cliApe = cliApe;
        this.cliDni = cliDni;
        this.cliCuil = cliCuil;
        this.cliFechAlta = cliFechAlta;
        this.cliDirPos = cliDirPos;
        this.cliTel = cliTel;
        this.cliMail = cliMail;
        ctaList = new ArrayList<Cuenta>();
    }

    public Integer getCliId() {
        return cliId;
    }

	public void setCliId(Integer cliId) {
        this.cliId = cliId;
    }

    public String getCliNro() {
        return cliNro;
    }

    public void setCliNro(String cliNro) {
        this.cliNro = cliNro;
    }

    public String getCliNom() {
        return cliNom;
    }

    public void setCliNom(String cliNom) {
        this.cliNom = cliNom;
    }

    public String getCliApe() {
        return cliApe;
    }

    public void setCliApe(String cliApe) {
        this.cliApe = cliApe;
    }

    public String getCliDni() {
        return cliDni;
    }

    public void setCliDni(String cliDni) {
        this.cliDni = cliDni;
    }

    public String getCliCuil() {
        return cliCuil;
    }

    public void setCliCuil(String cliCuil) {
        this.cliCuil = cliCuil;
    }

    public Date getCliFechAlta() {
        return cliFechAlta;
    }

    public void setCliFechAlta(Date cliFechAlta) {
        this.cliFechAlta = cliFechAlta;
    }

    public String getCliDirPos() {
        return cliDirPos;
    }

    public void setCliDirPos(String cliDirPos) {
        this.cliDirPos = cliDirPos;
    }

    public String getCliTel() {
        return cliTel;
    }

    public void setCliTel(String cliTel) {
        this.cliTel = cliTel;
    }

    public String getCliMail() {
        return cliMail;
    }

    public void setCliMail(String cliMail) {
        this.cliMail = cliMail;
    }
    
    public List<Cuenta> getCtaList() {
		return ctaList;
	}

	public void setCtaList(List<Cuenta> ctaList) {
		this.ctaList = ctaList;
	}

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (cliId != null ? cliId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Cliente)) {
            return false;
        }
        Cliente other = (Cliente) object;
        if ((this.cliId == null && other.cliId != null) || (this.cliId != null && !this.cliId.equals(other.cliId))) {
            return false;
        }
        return true;
    }

	@Override
	public String toString() {
		return "Cliente [cliId=" + cliId + ", cliNro=" + cliNro + ", cliNom="
				+ cliNom + ", cliApe=" + cliApe + ", cliDni=" + cliDni
				+ ", cliCuil=" + cliCuil + ", cliFechAlta=" + cliFechAlta
				+ ", cliDirPos=" + cliDirPos + ", cliTel=" + cliTel
				+ ", cliMail=" + cliMail + ", ctaList=" + ctaList + "]";
	}


    
}

